#pragma once

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <stdbool.h>

typedef int HPDataType;

typedef struct Heap
{
	int* a;
	int size;
	int capacity;
}HP;


void HeapPrint(HP* php);
void HeapInit(HP* php);
void HeapDestroy(HP* php);

void HeapCreate(HP* php, HPDataType* a, int n);

void HeapPush(HP* php, HPDataType x);
void HeapPop(HP* php);

HPDataType HeapTop(HP* php);

int HeapSize(HP* hp);
bool HeapEmpty(HP* hp);

void Swap(HPDataType* x, HPDataType* y);

void AdjustUp(HPDataType* a, int child);

void AdjustDown(HPDataType* a, int n, int parent);